package com.keyancompany.zhongbaopingtai.activity;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.os.Build;
import android.support.v7.widget.Toolbar;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.keyancompany.zhongbaopingtai.R;
import com.keyancompany.zhongbaopingtai.utils.IntentUtils;
import com.keyancompany.zhongbaopingtai.weight.AuthorPopup;
import com.keyancompany.zhongbaopingtai.weight.MenuPopuWindow;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * 认证信息
 */
public class AutherInfoActivity extends BaseActivity {


    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.request_auther)
    TextView requestAuther;

    AuthorPopup authorPopup;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_auther_info;
    }

    @Override
    protected int getMenuId() {
        return 0;
    }

    @Override
    protected void initToolBar() {
        initToolBar(toolbar, "认证信息");
    }

    @Override
    protected void setUpViews() {

    }

    @SuppressLint("NewApi")
    @OnClick(R.id.request_auther)
    public void toRealNameAuther(View view) {

        if (authorPopup == null) {
            authorPopup = new AuthorPopup(this);
            authorPopup.setCliclSureListener(new MenuPopuWindow.ClickSureListener() {
                @Override
                public void clickSureLinstener(String... param) {
                    if (param[0].equals("company")) {
                        IntentUtils.startActivity(mContext, RealNameCompanyActivity.class);
                    } else {
                        IntentUtils.startActivity(mContext, RealNameAutherActivity.class);
                    }
                    authorPopup.dismiss();
                }
            });
        }
        if (!authorPopup.isShowing()) {
            authorPopup.showAtLocation(view, Gravity.CENTER, 0, 0);
        }


    }
}
